home *** CD-ROM | disk | FTP | other *** search
- global gHistory, gBaseURL, gReadyToGo, cgiFlag
-
- on getLoadID theMovie
- preloadNetThing(theMovie)
- set currID to GetLatestNetID()
- return currID
- end
-
- on waitForTicks theTicks
- set startTime to the timer
- repeat while (startTime + theTicks) > the timer
- nothing()
- end repeat
- end
-
- on goMovie theMovie
- if not (theMovie contains ".dcr") then
- set theMovie to theMovie & ".dcr"
- end if
- set gReadyToGo to 1
- goToNetMovie(theMovie)
- fadeAllSounds(200)
- end
-
- on goPage thePage, target
- recordHistory(thePage)
- set gReadyToGo to 1
- if not target then
- goToNetPage(thePage)
- fadeAllSounds(200)
- else
- goCookiePage(thePage)
- end if
- end
-
- on getFileName theURL
- repeat with i = the number of chars in theURL down to 1
- if (char i of theURL = "/") or (char i of theURL = ":") then
- set rVal to char i + 1 to the number of chars in theURL of theURL
- exit repeat
- end if
- end repeat
- return rVal
- end
-
- on getCurrLabel
- set lastLine to the number of lines in the labelList - 1
- repeat with i = 1 to lastLine
- if the frame < label(line i of the labelList) then
- if i > 1 then
- return line i - 1 of the labelList
- else
- return EMPTY
- end if
- exit
- end if
- end repeat
- return line lastLine of the labelList
- end
-
- on goCookiePage thePage
- put thePage
- if not cgiFlag then
- getNetText("cgi/cookie_set.cgi?cookieName=nextPage;cookieValue=" & thePage)
- set cgiFlag to 1
- set gReadyToGo to 1
- end if
- end
-
- on checkCGI
- if cgiFlag = 1 then
- if NetDone() = 1 then
- set cgiFlag to 0
- set gReadyToGo to 0
- return NetTextResult()
- exit
- end if
- end if
- return 0
- end
-
- on fadeAllSounds fadeDuration
- if soundBusy(1) or soundBusy(2) then
- set lPlaying to 1
- end if
- if soundBusy(1) then
- sound fadeOut 1, fadeDuration
- end if
- if soundBusy(2) then
- sound fadeOut 2, fadeDuration
- end if
- if lPlaying then
- waitForTicks(fadeDuration)
- end if
- end
-
- on recordHistory theURL
- if not gHistory then
- set gHistory to []
- end if
- set index to getPos(gHistory, theURL)
- if index then
- deleteAt(gHistory, index)
- end if
- append(gHistory, theURL)
- end
-
- on allSprites pup, vis, start, stop
- if not start then
- set start to 1
- end if
- if not stop then
- set stop to 48
- end if
- repeat with i = start to stop
- if not (pup = -1) then
- puppetSprite(i, pup)
- end if
- if not (vis = -1) then
- set the visible of sprite i to vis
- end if
- end repeat
- end
-
- on distance point1, point2
- set xDiff to the locH of point2 - the locH of point1
- set yDiff to the locV of point2 - the locV of point1
- set dist to sqrt(power(xDiff, 2) + power(yDiff, 2))
- return dist
- end
-
- on makeTriangle radLength, radLoc, twoPoint
- set thirdPoint to point(the locH of radLoc, the locV of radLoc - radLength)
- set thirdSide to distance(thirdPoint, twoPoint)
- return thirdSide
- end
-
- on pythagoras radLen, sideLen
- set rvSquare to power(radLen, 2) - power(sideLen, 2)
- return integer(sqrt(rvSquare))
- end
-
- on radians degrees
- set rVal to degrees * (PI / 180)
- return rVal
- end
-
- on degrees radians
- set rVal to radians * 180 / PI
- return rVal
- end
-
- on spriteCenter theSprite
- set rVal to the right of sprite theSprite - integer(the width of sprite theSprite / 2)
- return rVal
- end
-
- on getFollowAngle theSprite, rXpoint
- global oldMousePoint, oldAngle, oldSprite
- set mousePoint to point(the mouseH, the mouseV)
- if mousePoint <> getaProp(oldMousePoint, theSprite) then
- if not rXpoint then
- set rXpoint to spriteCenter(theSprite)
- end if
- if the mouseH > rXpoint then
- set mult to 1
- else
- set mult to -1
- end if
- set radLength to distance(the loc of sprite theSprite, mousePoint)
- set thirdSide to makeTriangle(radLength, the loc of sprite theSprite, mousePoint) / 2
- set chordLen to pythagoras(radLength, thirdSide)
- setaProp(oldMousePoint, theSprite, mousePoint)
- if chordLen <> 0 then
- set rVal to atan(thirdSide / chordLen) * (360 / PI)
- if not integer(rVal) then
- if string(rVal) contains "-" then
- set rVal to 180
- end if
- else
- set rVal to rVal * mult
- end if
- else
- set rVal to 180
- end if
- setaProp(oldAngle, theSprite, rVal)
- else
- set rVal to getaProp(oldAngle, theSprite)
- end if
- return rVal
- end
-